﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using YasharEl.Infrastructure.Core.Commenting;
using YasharEl.Infrastructure.TaskEngine.Commenting;

namespace YasharEl.Infrastructure.TaskEngine.DomainModel
{
    [ContractClass(typeof(TaskCommentingManagerContract))]
    public interface ITaskCommentingManager
    {
        IList<IComment> GetComments(long applicationId, long userId, long taskInstanceId);

        IComment AddComment(long applicationId, long userId, long taskInstanceId, long commentOwnerId, TaskCommentType commentType, string comment);
    }

    [ContractClassFor(typeof(ITaskCommentingManager))]
    internal abstract class TaskCommentingManagerContract : ITaskCommentingManager
    {
        public IList<IComment> GetComments(long applicationId, long userId, long taskInstanceId)
        {
            Contract.Requires<ArgumentNullException>(applicationId > 0, "applicationId must be valid positive numeric value.");
            Contract.Requires<ArgumentNullException>(userId > 0, "userId must be valid positive numeric value.");
            Contract.Requires<ArgumentException>(taskInstanceId > 0, "taskInstanceId could not be 0.");

            return new List<IComment>();
        }

        public IComment AddComment(long applicationId, long userId, long taskInstanceId, long commentOwnerId, TaskCommentType commentType, string comment)
        {
            Contract.Requires<ArgumentNullException>(applicationId > 0, "applicationId must be valid positive numeric value.");
            Contract.Requires<ArgumentNullException>(userId > 0, "userId must be valid positive numeric value.");
            Contract.Requires<ArgumentNullException>(taskInstanceId > 0, "taskInstanceId must be valid positive numeric value.");
            Contract.Requires<ArgumentNullException>(commentOwnerId > 0, "commentOwnerId must be valid positive numeric value.");
            Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(comment), "comment could not be empty.");

            return default(IComment);
        }
    }
}
